package com.banmao.c02_abstract_factory;

import com.banmao.c02_abstract_factory.factory.GUIFactory;
import com.banmao.c02_abstract_factory.factory.impl.MacOSFactory;
import com.banmao.c02_abstract_factory.factory.impl.WindowsFactory;

public class Demo {

    /*
        抽象工厂模式：
            在工厂模式的基础上，将工厂进行抽象，使得允许选择多个工厂实现来生产统一规格的产品
     */

    public static void main(String[] args) {
        Application application = configureApplication();
        application.paint();
    }

    private static Application configureApplication() {
        Application app;
        GUIFactory guiFactory;

        String osName = "";

        if (osName.contains("mac")) {
            guiFactory = new MacOSFactory();
        } else {
            guiFactory = new WindowsFactory();
        }

        app = new Application(guiFactory);
        return app;

    }

}
